package mapper;

import entity.StatisticsResult;
import entity.TimeResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Ray
 * @date 2020/6/20 10:43
 */
public interface StatisticsMapper {

    List<StatisticsResult> customerOrder();

    List<StatisticsResult> managerOrder();

    TimeResult selectByYear(String time);

    List<TimeResult> selectByMonth(@Param(value = "time") String time);

    List<TimeResult> selectByDay(@Param(value = "time") String date, @Param(value = "days") String days);


    @Select("select count(*) price,CREDIT as name from CUSTOMER group by CREDIT")
    List<StatisticsResult> selectByCredit();

    @Select("select count(*) price,LEVELS as name from CUSTOMER group by LEVELS")
    List<StatisticsResult> selectByGrade();

    @Select("select count(*) price,MATURITY as name from CUSTOMER group by MATURITY")
    List<StatisticsResult> selectByMaturity();

    @Select("select count(*) price,SOURCE as name from CUSTOMER group by SOURCE")
    List<StatisticsResult> selectBySource();

    @Select("select count(*) price,STATUS as name from CUSTOMER group by STATUS")
    List<StatisticsResult> selectByStatus();

    @Select("select count(*) price,TYPE as name from CUSTOMER group by TYPE")
    List<StatisticsResult> selectByType();
}
